import { Link } from '@brillout/docpress'
import { JustAMiddleware } from '../../components'

You can embed Vike into any server, and use any server utility.

> Alternatively, instead of using a server, you can <Link href="/pre-rendering">pre-render</Link> your pages and deploy to a <Link href="/static-hosts">static host</Link>.

## Just a middleware

<JustAMiddleware />

You can use:
- Any server framework (Express, Fastify, Hono, Nitro, HatTip, Koa, Hapi, ...)
- Any authentication strategy/tool (email/password, OAuth, Auth.js, Passport.js, Grant, Keycloak, Auth0, ...).
- Any serverless/edge environment (Cloudflare Workers, Vercel, Firebase, AWS Lambda, Google Cloud Functions, Deno Deploy, ...)
- Any virtual private server (AWS EC2, Google Cloud, ...)
- Any static host (Cloudflare Pages, GitHub Pages, Netlify, ...)
- Any server utility (Docker, Nginx, PM2, ...)

Examples:

- <Link href="/express" />
- <Link href="/hono" />
- <Link href="/fastify" />
- <Link href="/docker" noBreadcrumb />
- <Link href="/nginx" />
- <Link href="/examples#server">... more</Link>


## Non-JavaScript Backend

You can use Vike with a non-JavaScript backend using following setup:
 - Your non-JavaScript backend implements the business logic of data while exposing a REST/GraphQL API.
 - Your Vike app uses that REST/GraphQL API to <Link href="/ssr">render your pages to HTML</Link> while <Link href="/hydration">hydrating</Link> them to a rich interactive user interface.

> If you want SSR, then you need to deploy two server runtimes: your non-JavaScript runtime as well as a JavaScript server runtime (Node.js/Deno/Bun).
>
> Alternatively, instead of using a server JavaScript runtime, you can <Link href="/pre-rendering">pre-render</Link> your pages while <Link href="/ssr">disabling SSR</Link>. In other words: you generate empty HTML shells that you statically deploy (using a <Link href="/static-hosts">static host</Link> or your own static assets deployment).

> The HTML must be generated by Vike because the UI is *completely* owned by React/Vue/Solid. You cannot generate the HTML using your non-JavaScript backend: React/Vue/Solid would <Link href="/hydration-mismatch">complain that it doesn't match</Link> and completely erase your HTML.

That way, you can use Vike with any backend:
- Java (Spring, Grails, ...)
- PHP (Laravel, Symfony, CakePHP, ...)
- Ruby on Rails
- Python (Django, Flask, FastAPI, ...)
- Elixir (Phoenix, ...)
- Go (Gin, Echo, Fiber, ...)
- Rust (Actix Web, Rocket, ...)
- Backend-as-a-Service (Firebase, ..)
- ...

Example:
- <Link href="/ruby-on-rails" />


## HTTPS

In production, Vike is only a server middleware; there is nothing to take into consideration.

If you want to use HTTPS in development as well, then make sure to [pass the HTTPS certificates to Vite's dev server](https://vitejs.dev/config/server-options.html#server-https).


## See also

- <Link href="/renderPage" />
- <Link href="/examples#server" />
- <Link href="/deploy" />
